<?php

namespace App\Repositories\Api;

use Illuminate\Support\Facades\DB;

class LikeRepository
{
    //点赞
    public function getLists($filter = [], $pageSize = 10, $pageNum = 1)
    {
        $res = DB::table("star as s")
            ->join("trend as t", "t.id", "=", "s.object_id")
            ->join("member as m", "m.id", "=", "s.uid")
            ->where("t.status", 1)
            ->where(['s.object_type' => $filter['object_type'], 's.object_id' => $filter['object_id']])
//            ->orderBy('tc.id', 'desc')
            ->whereNull("s.deleted_at")
            ->orderBy("s.id", "desc")
            ->paginate($pageSize, ['m.id', 'm.username', 'm.gender', 'm.avatar', 's.create_time'], null, $pageNum)
            ->toArray();

        $res = filterPaginateData($res);

        foreach ($res['items'] as $k => &$v) {

        }

        return $res;
    }
}


